package top.yueyazhui.mysql_audit_log.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import top.yueyazhui.mysql_audit_log.service.IAuditLogService;

import java.util.Map;

@Controller
public class AuditLogController {

    @Autowired
    IAuditLogService auditLogService;

    @GetMapping
    public String getAuditLog() {
        return "auditLog";
    }

    @GetMapping("list")
    @ResponseBody
    public Map<String, Object> getAuditLog(@RequestParam(defaultValue = "20") Integer count, @RequestParam(defaultValue = "") String[] params) {
        return auditLogService.getAuditLog(count, params);
    }
}
